package com.clouddot.baipai.util.ThreadPool;

public class ThreadPool implements IThread {

    private static ThreadPoolProxy mNormalPool = null;
    private static ThreadPool _intance = null;

    private ThreadPool() {

    }

    public static ThreadPool getInstance() {
        if (_intance == null) {
            synchronized (ThreadPool.class) {
                _intance = new ThreadPool();
            }
        }
        return _intance;
    }

    @Override
    public void execute(Runnable runnable) {
        if (mNormalPool == null) {
            synchronized (ThreadPoolProxy.class) {
                if (mNormalPool == null) {
                    mNormalPool = new ThreadPoolProxy(5, 15, 2000);
                    mNormalPool.execute(runnable);
                }
            }
        } else {
            mNormalPool.execute(runnable);
        }
    }
}
